package buaa.com.util;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2016/4/25.
 */
public class FileUtils {
    private static List<String> fileList = new ArrayList<String>();
    public static List<String> readAll(String path , String extName){
        File file = new File(path);
        File[] files = file.listFiles();
        for( int i = 0 ; i < files.length ; i++){
            if( !files[i].isDirectory()){
                if(files[i].getName().endsWith(extName)){
                    fileList.add(files[i].getAbsolutePath());
                }
            }else{
                readAll(files[i].getPath(),extName);
            }
        }

        return fileList;
    }
}
